import 'package:efood_multivendor/helper/size_config.dart';
import 'package:efood_multivendor/util/dimensions.dart';
import 'package:flutter/material.dart';
import 'package:flutter_feather_icons/flutter_feather_icons.dart';

class QuantityButton extends StatelessWidget {
  final bool isIncrement;
  final Function() onTap;
  final bool isActive;
  QuantityButton(
      {required this.isIncrement, required this.onTap, required this.isActive});

  @override
  Widget build(BuildContext context) {
    return InkWell(
      onTap: onTap,
      child: isIncrement
          ? Container(
              height: 4.h,
              width: 4.h,
              margin: EdgeInsets.symmetric(
                  horizontal: Dimensions.PADDING_SIZE_SMALL),
              decoration: BoxDecoration(
                borderRadius: BorderRadius.circular(10),
                gradient: LinearGradient(
                    begin: Alignment.topLeft,
                    end: Alignment.topRight,
                    colors: isActive
                        ? [
                            Theme.of(context).primaryColor,
                            Theme.of(context).colorScheme.secondary
                          ]
                        : [
                            Theme.of(context).disabledColor,
                            Theme.of(context).disabledColor
                          ]),
              ),
              alignment: Alignment.center,
              child: Icon(
                Icons.add,
                size: 15,
                color: Theme.of(context).cardColor,
              ),
            )
          : Container(
              height: 4.h,
              width: 4.h,
              margin: EdgeInsets.symmetric(
                  horizontal: Dimensions.PADDING_SIZE_SMALL),
              decoration: BoxDecoration(
                borderRadius: BorderRadius.circular(10),
                border: Border.all(
                    width: 1,
                    color: isActive
                        ? Theme.of(context).primaryColor
                        : Theme.of(context).disabledColor),
                color: Theme.of(context).disabledColor.withOpacity(0.2),
              ),
              alignment: Alignment.center,
              child: Icon(
                FeatherIcons.minus,
                size: 15,
                color: isActive
                    ? Theme.of(context).colorScheme.secondary
                    : Theme.of(context).disabledColor,
              ),
            ),
    );
  }
}
